<template>
    <p>这是一个home页</p>
    <p>js跳转</p>
    <button @click="pushStr">字符串-跳转</button>
    <button @click="pushPath">push-path-跳转</button>
    <button @click="pushNameQuery">push-路径-query-跳转</button>
    <button @click="pushNameParams">push-命名路由-参数</button>
</template>

<script>

export default{
    methods:{
        pushStr(){
            this.$router.push("/about")
        },
        pushPath(){
            this.$router.push({path:"about"})
        }, 
        pushNameParams(){
            this.$router.push({path:'about',state:{params:{id:2,name:'tom' }}})
        },
        pushNameQuery(){
            this.$router.push({path:"/about",query:{id:2,name:'tom'}})
        }
    },
    mounted(){
    console.log('this.$route',this.$route);
    console.log('this.$router',this.$router);
    },
    // pushDynRouteByName(){
    //     this.$router.push({name:'product',params:{id:123}})
    // },
    // pushDynRouteByPath(){
    //     const id = 123;
    //     this.$router.push({path:'/product'+'/'+id});
    // }
}
</script>